<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>

<?php
require_once './../class/Evaluation.inc';

$list_cnt = $_POST ['list_cnt'];
$timecheck = $_POST ['timecheck'];

//echo "<br>list_cnt=".$list_cnt;
//echo "<br>timecheck=".$timecheck;

for($i = 0; $i < $list_cnt; $i++ ){
	$val0[$i] = $_POST['mem_id'.$i];
	$val1[$i] = $_POST['h_mem_id'.$i];
	$val2[$i] = $_POST['chkscore'.$i];
	$val3[$i] = $_POST['maxscore'.$i];
	$val4[$i] = $_POST['classcode'.$i];
	$val5[$i] = $timecheck;
}
$x = 0;
for($j = 0; $j < $list_cnt; $j++ ){
	if($j == 0){
		$sum0[$x] = $val0[$j];
		$sum1[$x] = $val1[$j];
		$sum2[$x] = $val2[$j];
		$sum3[$x] = $val3[$j];
		$sum4[$x] = $val4[$j];
		$sum5[$x] = $val5[$j];
	}
	else if($j>0 && $val4[$j] == $sum4[$x] && $val1[$j] == $sum1[$x]){
		$sum2[$x] = $sum2[$x] + $val2[$j];
		$sum3[$x] = $sum3[$x] + $val3[$j];
	}else{
		$x++;
		$sum0[$x] = $val0[$j];
		$sum1[$x] = $val1[$j];
		$sum2[$x] = $val2[$j];
		$sum3[$x] = $val3[$j];
		$sum4[$x] = $val4[$j];
		$sum5[$x] = $val5[$j];
	}
}

for($z = 0; $sum0[$z] != ""; $z++){
	//echo "<br>".$sum0[$z].",".$sum1[$z].",".$sum2[$z].",".$sum3[$z].",".$sum4[$z].",".$sum5[$z];
	$eval = new Evaluation();
	$eval->createEvaluation($sum0[$z],$sum1[$z],$sum2[$z],$sum3[$z],$sum4[$z],$sum5[$z]);
}

?>
<script type="text/javascript">
alert("<?php echo $mem_nm?> 회원님의 평가수행이 완료되었습니다.");
location.href="../evaluation.php";
</script>
</body>

</html>